/**
 * 
 */
package com.leyu.search.service;

/**
 * @author change
 *
 */
public class PageHelper {

	public static int getStart(int pageNum,int pageSize){
		int start=(pageNum-1)*pageSize;
		if(start<=0){
			start=0;
		}
		
		return start;
	}
	
	public static int getTotalPages(long totalSize,int pageSize){
		int pages=(int) (totalSize/pageSize);
		int n=(int) (totalSize%pageSize);
		if(n>0){
			return pages+1;
		}else{
			return pages;
		}
	}
}
